﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local='clr-namespace:NczControlLibrary.Controls'>
    <Style TargetType='local:SearchBox'>
        <Setter Property='Template'>
            <Setter.Value>
                <ControlTemplate TargetType='local:SearchBox'>
                    <Border x:Name='root' Visibility='{TemplateBinding Property=Visibility}' Projection='{TemplateBinding Property=Projection}' Padding='{TemplateBinding Property=Padding}' OpacityMask='{TemplateBinding Property=OpacityMask}' Opacity='{TemplateBinding Property=Opacity}' VerticalAlignment='{TemplateBinding Property=VerticalAlignment}' HorizontalAlignment='{TemplateBinding Property=HorizontalAlignment}' Width='{TemplateBinding Property=Width}' Height='{TemplateBinding Property=Height}' FlowDirection='{TemplateBinding Property=FlowDirection}' Effect='{TemplateBinding Property=Effect}' DataContext='{TemplateBinding Property=DataContext}' CornerRadius='{TemplateBinding Property=CornerRadius}' BorderThickness='{TemplateBinding Property=BorderThickness}' Background='{TemplateBinding Property=Background}' BorderBrush='{TemplateBinding Property=BorderBrush}'>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup>
                                <VisualState x:Name='woking'>
                                    <Storyboard RepeatBehavior='forever'>
                                        <ObjectAnimationUsingKeyFrames Duration='0:0:0' Storyboard.TargetName='cs' Storyboard.TargetProperty='Visibility'>
                                            <DiscreteObjectKeyFrame KeyTime='0:0:0' Value='Visible'/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration='0:0:3' To='{Binding ElementName=root,Path=ActualWidth}' Storyboard.TargetName='current' Storyboard.TargetProperty='(Canvas.Left)'>
                                            <DoubleAnimation.EasingFunction>
                                                <PowerEase/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation Duration='0:0:1.5' AutoReverse='True' To='30' From='5.0' Storyboard.TargetName='current' Storyboard.TargetProperty='Width'>
                                            <DoubleAnimation.EasingFunction>
                                                <SineEase EasingMode='EaseInOut'/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='normal'/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height='*'/>
                                <RowDefinition Height='auto'/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width='20'/>
                                <ColumnDefinition Width='*'/>
                                <ColumnDefinition Width='20'/>
                            </Grid.ColumnDefinitions>
                            <Canvas x:Name='cs' Height='2' Visibility='Collapsed' Grid.Row='1' Grid.Column='0' Grid.ColumnSpan='3' Background='Gray' HorizontalAlignment='Stretch' VerticalAlignment='Stretch'>
                                <Rectangle x:Name='current' Fill='White' Opacity='1' Height='3' Width='30'>
                                    <Rectangle.Effect>
                                        <BlurEffect/>
                                    </Rectangle.Effect>
                                </Rectangle>
                      
                            </Canvas>
                            <Rectangle Grid.Column='0' Grid.ColumnSpan='3' Height='2' Visibility='Collapsed' x:Name='progressBar' Grid.Row='1' HorizontalAlignment='Stretch'/>
                            <Grid Grid.Column='0' Grid.ColumnSpan='3' HorizontalAlignment='Stretch' VerticalAlignment='Stretch'>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width='*'/>
                                    <ColumnDefinition Width='auto'/>
                                    <ColumnDefinition Width='auto'/>
                                </Grid.ColumnDefinitions>
                                <TextBox FontSize='{TemplateBinding Property=FontSize}' Padding='2,0,2,0' VerticalContentAlignment='Center' Margin='{TemplateBinding Property=Padding}' BorderThickness='0' Background='Transparent' Text='{TemplateBinding Property=Text}' Foreground='{TemplateBinding Property=Foreground}'>
                                    <TextBox.Template>
                                        <ControlTemplate TargetType="TextBox">
                                            <Grid x:Name="RootElement">
                                                <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="1" Opacity="1">
                                                    <Grid>
                                                        <Border x:Name="ReadOnlyVisualElement" Background="#5EC9C9C9" Opacity="0"/>
                                                        <Border x:Name="MouseOverBorder" BorderBrush="Transparent" BorderThickness="1">
                                                            <ScrollViewer x:Name="ContentElement" BorderThickness="0" IsTabStop="False" Padding="{TemplateBinding Padding}"/>
                                                        </Border>
                                                    </Grid>
                                                </Border>
                                            </Grid>
                                        </ControlTemplate>
                                    </TextBox.Template>
                                </TextBox>
                                <HyperlinkButton x:Name='hbClose' Visibility='Collapsed' Grid.Column='1' Foreground='Red' Content='X' HorizontalContentAlignment='Center' VerticalContentAlignment='Center'/>
                                <HyperlinkButton Grid.Column='2' x:Name='hbConfirm' HorizontalContentAlignment='Center' VerticalContentAlignment='Center'>
                                    <HyperlinkButton.Content>
                                        <Path Stretch='Uniform' Fill='{TemplateBinding Property=Fill}' Stroke='{TemplateBinding Property=Stroke}' Width='{TemplateBinding Property=IconWidth}' Height='{TemplateBinding Property=IconHeight}' Data='F1M54.8672,51.2266L42.1145,36.0703C44.2473,33.3333 45.6692,29.9946 46.0469,26.2942 47.1016,15.8333 39.4948,6.49219 29.0313,5.43213 18.5729,4.37231 9.2395,11.9868 8.17188,22.4453 7.10938,32.9036 14.7291,42.2446 25.1875,43.3098 28.6692,43.6563 32.0416,43.0469 35.0051,41.6797L47.9244,57.0547C49.5416,58.9634 52.401,59.2134 54.3125,57.6094 56.2266,55.9973 56.4766,53.1348 54.8672,51.2266 M15.9219,23.1614C16.5547,16.9399 22.1094,12.4087 28.3333,13.0391 34.5573,13.6719 39.0781,19.2266 38.4453,25.4426 37.8098,31.6692 32.2708,36.1953 26.0416,35.5703 19.8203,34.9399 15.2891,29.3828 15.9219,23.1614'/>
                                    </HyperlinkButton.Content>
                                    <HyperlinkButton.Template>
                                        <ControlTemplate TargetType="HyperlinkButton">
                                            <Grid Background="{TemplateBinding Background}" Cursor="{TemplateBinding Cursor}">
                                                <TextBlock x:Name="UnderlineTextBlock" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Text="{TemplateBinding Content}" TextDecorations="Underline" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                                <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                            </Grid>
                                        </ControlTemplate>
                                    </HyperlinkButton.Template>
                                </HyperlinkButton>
                            </Grid>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
